package cn.ydt.ydt.sso.webapi.controller;


import cn.ydt.ydt.common.resful.JsonResult;
import cn.ydt.ydt.pojo.user.dto.UserLoginDTO;
import cn.ydt.ydt.sso.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/user/sso",produces = "application/json;charset=utf-8")
@Api(tags = "用户登录功能")
public class UserController {
    @Autowired
    UserService userService;

    @PostMapping("/login")
    @ApiOperation("用户登录接口")
    public JsonResult<String> userLogin(@RequestBody UserLoginDTO userLoginDTO){
       String jwt = userService.userLogin(userLoginDTO);
        return JsonResult.ok(jwt,"登录成功！");
    }
}
